<?php
require_once(dirname(__FILE__).'/simpletest/autorun.php');

if (!defined('ROOT_PATH')) {
   define('ROOT_PATH',dirname(dirname(dirname(__FILE__))));
}

require_once(ROOT_PATH.'/app/classes/model.php');
require_once(ROOT_PATH.'/app/models/path.php');
require_once(ROOT_PATH.'/app/models/directory.php');
require_once(ROOT_PATH.'/app/models/file.php');
require_once(ROOT_PATH.'/app/models/image.php');
require_once(ROOT_PATH.'/app/models/imagejpg.php');
require_once(ROOT_PATH.'/app/models/imagepng.php');
require_once(ROOT_PATH.'/app/models/pathfactory.php');
require_once(ROOT_PATH.'/app/models/imagefactory.php');

class TestOfImage extends UnitTestCase {
	function testImageFactory() {
		$image = new Ab_ImageFactory(ROOT_PATH.'/files/testFolder/06-oops.jpg');
		$this->assertTrue(is_a($image, 'Ab_ImageFactory'),'Routine Test:  Check instance type');
	}

	function testImageInstance() {
		$image = new Ab_Image(ROOT_PATH.'/files/testFolder/06-oops.jpg');
		$this->assertTrue(is_a($image, 'Ab_Image'),'Routine Test:  Check instance type');
	}
	
	
	function testImageType(){
		$image = new Ab_Image(ROOT_PATH.'/files/testFolder/06-oops.jpg');
		$imageType=$image->getImageType();
		$this->assertTrue(is_a($imageType, 'Ab_ImageJPG'),'Check instance type: JPG');
	}
	
	function testImagePath(){
		$image = new Ab_Image(ROOT_PATH.'/files/testFolder/06-oops.jpg');
		$path=$image->getPath();
		
		$expected=ROOT_PATH.'/files/testFolder/06-oops.jpg';
		$this->assertEqual($result=$path,$expected,'Path');
	}
	
	function testImageExtension(){
		$image = new Ab_Image(ROOT_PATH.'/files/testFolder/06-oops.jpg');
		$extension=$image->getExtension();
		
		$expected='.jpg';
		$this->assertEqual($result=$extension,$expected,'Extension');
	}
	
		

}
?>

